<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.it.dao.MessageDao"%>
<%@ page import="com.it.bean.Message"%>
<%@ page import="java.util.List"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>简易留言本</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<style type="text/css">
body {
	background-image: url("imag/bei.jpg");
}

.top {
	margin-top: 5px;
}

.border {
	border: 1px solid #96c2f1;
}

.borderTop {
	border-top: 1px dashed #96c2f1;
}

.left {
	border-left: 1px solid #96c2f1;
}

.right {
	border-right: 1px solid #96c2f1;
}

.center {
	text-align: center;
}
</style>
</head>

<body>
	<%
		MessageDao messageDao = new MessageDao();
		List<Message> messages = messageDao.getAll();
		request.setAttribute("messages", messages);
	%>
	<div class="container">
		<ul class="nav nav-pills col-md-offset-3">
			<li class="nav-item"><a class="nav-link active" href="#">首页</a>
			</li>
			<li class="nav-item"><a class="nav-link" href="index.jsp">给我留言</a>
			</li>
			<li class="nav-item"><a class="nav-link" href="messagebook.jsp">留言本</a>
			</li>
			<li class="nav-item"><a class="nav-link" href="login.jsp">管理</a>
			</li>
			<li class="nav-item"><a class="nav-link disabled" href="#">关于我们</a>
			</li>
		</ul>
		<c:forEach items="${requestScope.messages }" var="msg"
			varStatus="status">
			<div class="row top ">
				<div class="col-md-2 center">
					<img src="imag/head.jpg" width="100px">
				</div>
				<div class="col-md-8 border">
					<p class="top">
						[${status.index+1 }楼]&nbsp;<strong>${msg.nickname }</strong>&nbsp;发表于：${msg.createTime}
					</p>
					<p class="borderTop">
						<strong>标题</strong>：${msg.title }
					</p>
					<p class="borderTop">
						<strong>内容</strong>：${msg.content }
					</p>
				</div>
				<div class="col-md-8">
					<p>
						<font color="red"><strong>管理员回复</strong>：如果你在使用中遇到任何问题，可以给我留言，我尽量第一时间回复你的问题。</font>
					</p>
				</div>
			</div>
		</c:forEach>
		<div class="col-md-4 col-md-offset-4">
			<ul class="pagination">
				<li><a href="#">&laquo;</a></li>
				<li class="active"><a href="#">首页</a></li>
				<li><a href="#">上一页</a></li>
				<li><a href="#">下一页</a></li>
				<li><a href="#">尾页</a></li>
				<li><a href="#">&raquo;</a></li>
			</ul>
		</div>
	</div>
	<div class="container top ">
		<p class="col-md-offset-4">
			<strong>版权所有：</strong>简易留言本&nbsp;©2018
		</p>
	</div>
</body>
</html>
